package org.examplexx.mytestwebapplication.service.impl;
import org.examplexx.mytestwebapplication.Mapper.DeptMapper;
import org.examplexx.mytestwebapplication.pojo.Dept;
import org.examplexx.mytestwebapplication.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service//必须加这个注解
public class DeptServiceImpl implements DeptService {
    @Autowired
    private DeptMapper deptMapper;
    @Override
    public List<Dept> list() {
        return deptMapper.selectAll();
    }

    @Override
    public void delete(int id) {
        deptMapper.deleteById(id);
    }

    @Override
    public void add(Dept dept) {
        deptMapper.insert(dept);
    }

    @Override
    public Dept get(int id) {
        return deptMapper.selectById(id);
    }

    @Override
    public void update(Dept dept) {
        deptMapper.update(dept);
    }
}
